package com.hckj.medical.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hckj.medical.entity.Report;
import com.hckj.medical.mapper.ReportMapper;
import com.hckj.medical.service.IReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hckj
 * @since 2023-11-25
 */
@Service
public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> implements IReportService {
    @Autowired
    private ReportMapper reportMapper;
    @Override
    public Page<Map> selectAll(Map map) {
        Integer pageNo = (Integer) map.get("pageNo");
        Integer pageSize = (Integer) map.get("pageSize");
        Page<Map> page = new Page<>(pageNo,pageSize);
        return reportMapper.findall(page,map);
    }

    @Override
    public void insertReport(Report report) {
        reportMapper.insert(report);
    }

    @Override
    public Report findByid(Integer id) {
        return reportMapper.selectById(id);
    }
}
